package com.omenkk.juc.synchronizedPlus;

import com.omenkk.juc.util.Slepper;
import lombok.extern.slf4j.Slf4j;
import com.omenkk.juc.util.Slepper.*;
@Slf4j
public class demo6 {
    public static void main(String[] args)  {
        Thread main = Thread.currentThread();
        Thread t1= new Thread(() -> {
            log.debug("t1开始运行");
            log.debug("t1进入七秒休眠");
            Slepper.sleep(4);
            main.interrupt();
           Slepper.sleep(5);
           log.debug("t1执行完毕");
        });
        t1.start();
        //等待t1执行结束，同时自己进入waiting状态
        log.debug("t1.join执行，主线程进入waiting...");
        try {
            t1.join();
        } catch (InterruptedException e) {
         e.printStackTrace();
        }
        log.debug("被interrupt唤醒");


    }
}
